﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace homework1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string s1 = "";
            string s2 = "";
            Console.Write("请输入第一个操作数：");
            s1 = Console.ReadLine();
            Console.Write("请输入第二个操作数：");
            s2 = Console.ReadLine();
            char opcode;
            Console.Write("请输入操作符:");
            opcode = Console.ReadKey().KeyChar;
            Console.WriteLine();
            int op1, op2;
            int.TryParse(s1, out op1);
            int.TryParse(s2, out op2);
            int result = 0;

            switch (opcode)
            {
                case '+':
                    result = op1 + op2;
                    Console.WriteLine("计算结果为：" + result);
                    break;
                case '-':
                    result = op1 - op2;
                    Console.WriteLine("计算结果为：" + result);
                    break;
                case '*':
                    result = op1 * op2;
                    Console.WriteLine("计算结果为：" + result);
                    break;
                case '/':
                    result = op1 / op2;
                    Console.WriteLine("计算结果为：" + result);
                    break;
                case '%':
                    result = op1 % op2;
                    Console.WriteLine("计算结果为：" + result);
                    break;
                default:
                    Console.WriteLine("你输入了非法字符,无法计算");
                    break;
            }

            //Console.WriteLine(result);
            //Console.ReadLine();
            Console.WriteLine("按任意键继续...");
            Console.ReadKey();///
        }
    }
}